#include <REGX52.H>
#include "Delay.h"
#include "Matrix.h"

//这样是把数组放到RAM里面，就是程序运行时的暂存寄存器，
//如果想放到flash里面，就是程序存储器，这里面的空间会大一些，
//而且flash里面的数据不能被改变
//unsigned char Automation[] = {
//0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//0xFF,0x08,0x08,0x08,0xFF,0x00,0x0E,0x15,
//0x15,0x15,0x08,0x00,0x7F,0x01,0x01,0x01,
//0x00,0x7F,0x01,0x01,0x01,0x00,0x1E,0x21,
//0x21,0x21,0x1E,0x00,0x7D,0x00,0x00,0x00,
//0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//};//这个是放到RAM里面

//unsigned char code Automation[] = {
//0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//0xFF,0x08,0x08,0x08,0xFF,0x00,0x0E,0x15,
//0x15,0x15,0x08,0x00,0x7F,0x01,0x01,0x01,
//0x00,0x7F,0x01,0x01,0x01,0x00,0x1E,0x21,
//0x21,0x21,0x1E,0x00,0x7D,0x00,0x00,0x00,
//0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//};//这个是放到flash里面，再前面加一个code

//unsigned char Automation[] = {
//0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//0x20,0x50,0x88,0x84,0x42,0x21,0x42,0x84,
//0x88,0x50,0x20,0x00,0x20,0x50,0x88,0x84,
//0x42,0x21,0x42,0x84,0x88,0x50,0x20,0x00,
//0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
//};

unsigned char Automation[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x22,0x24,0xA8,0x72,0x29,0x27,0x20,0x00,
0x00,0x00,0x00,0x49,0x49,0x49,0x7F,0x4D,
0x4B,0x49,0x00,0x00,0x0C,0x12,0x21,0x4D,
0x41,0x41,0x41,0x4D,0x21,0x12,0x0C,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

void main()
{
	unsigned char i=0,offset=0,count=0;
	void Matrix_Init();
	while(1)
	{
		for(i=0;i<8;i++)
		{
			MatrixLED_ShowColumn(i,Automation[i+offset]);//选中第i列，输入的数据是Automation里面第i个
		}
		count++;//这个相当于延时
		if(count>10)
		{
			count = 0;
			offset++;
			//offset就相当于是第几个进来，第一次就是0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
			//第二次就相当于是0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF，以实现流水
			if(offset>40)//这里就是你看他最后显示是最后8个，不能越位，你设计的-8
			{
				offset = 0;
			}
		}
	
	}
}
